home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
PCSSP.LZH
/
PC-SSP.ZIP
/
POLYSPTP.ZIP
/
DTCSP.FOR
< prev
next >
Wrap
Text File
|
1985-11-29
|
3KB
|
99 lines
C
C ..................................................................
C
C SUBROUTINE DTCSP
C
C PURPOSE
C A SERIES EXPANSION IN SHIFTED CHEBYSHEV POLYNOMIALS WITH
C INDEPENDENT VARIABLE X IS TRANSFORMED TO A POLYNOMIAL WITH
C INDEPENDENT VARIABLE Z, WHERE X=A*Z+B.
C
C USAGE
C CALL DTCSP(A,B,POL,N,C,WORK)
C
C DESCRIPTION OF PARAMETERS
C A - FACTOR OF LINEAR TERM IN GIVEN LINEAR TRANSFORMATION
C DOUBLE PRECISION VARIABLE
C B - CONSTANT TERM IN GIVEN LINEAR TRANSFORMATION
C DOUBLE PRECISION VARIABLE
C POL - COEFFICIENT VECTOR OF POLYNOMIAL (RESULTANT VALUE)
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C DOUBLE PRECISION VECTOR
C N - DIMENSION OF COEFFICIENT VECTORS POL AND C
C C - GIVEN COEFFICIENT VECTOR OF EXPANSION
C POL AND C MAY BE IDENTICALLY LOCATED
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C DOUBLE PRECISION VECTOR
C WORK - WORKING STORAGE OF DIMENSION 2*N
C DOUBLE PRECISION ARRAY
C
C REMARKS
C COEFFICIENT VECTOR C REMAINS UNCHANGED IF NOT COINCIDING
C WITH COEFFICIENT VECTOR POL.
C OPERATION IS BYPASSED IN CASE N LESS THAN 1.
C THE LINEAR TRANSFORMATION X=A*Z+B OR Z=(1/A)(X-B) TRANSFORMS
C THE RANGE (0,1) IN X TO THE RANGE (ZL,ZR) IN Z, WHERE
C ZL=-B/A AND ZR=(1-B)/A.
C FOR GIVEN ZL, ZR WE HAVE A=1/(ZR-ZL) AND B=-ZL/(ZR-ZL).
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C THE TRANSFORMATION IS BASED ON THE RECURRENCE EQUATION FOR
C SHIFTED CHEBYSHEV POLYNOMIALS TS(N,X)
C TS(N+1,X)=(4*X-2)*TS(N,X)-TS(N-1,X),
C WHERE THE FIRST TERM IN BRACKETS IS THE INDEX,
C THE SECOND IS THE ARGUMENT.
C STARTING VALUES ARE TS(0,X)=1, TS(1,X)=2*X-1.
C THE TRANSFORMATION IS IMPLICITLY DEFINED BY MEANS OF
C X=A*Z+B TOGETHER WITH
C SUM(POL(I)*Z**(I-1), SUMMED OVER I FROM 1 TO N)
C =SUM(C(I)*TS(I-1,X), SUMMED OVER I FROM 1 TO N).
C
C ..................................................................
C
SUBROUTINE DTCSP(A,B,POL,N,C,WORK)
C
DIMENSION POL(1),C(1),WORK(1)
DOUBLE PRECISION A,B,POL,C,WORK,H,P,XD,X0
C
C TEST OF DIMENSION
IF(N-1)2,1,3
C
C DIMENSION LESS THAN 2
1 POL(1)=C(1)
2 RETURN
C
3 XD=A+A
X0=B+B-1.D0
POL(1)=C(1)+C(2)*X0
POL(2)=C(2)*XD
IF(N-2)2,2,4
C
C INITIALIZATION
4 WORK(1)=1.D0
WORK(2)=X0
WORK(3)=0.D0
WORK(4)=XD
XD=XD+XD
X0=X0+X0
C
C CALCULATE COEFFICIENT VECTOR OF NEXT SHIFTED CHEBYSHEV
C POLYNOMIAL AND ADD MULTIPLE OF THIS VECTOR TO POLYNOMIAL POL
DO 6 J=3,N
P=0.D0
C
DO 5 K=2,J
H=P-WORK(2*K-3)+X0*WORK(2*K-2)
P=WORK(2*K-2)
WORK(2*K-2)=H
WORK(2*K-3)=P
POL(K-1)=POL(K-1)+H*C(J)
5 P=XD*P
WORK(2*J-1)=0.D0
WORK(2*J)=P
6 POL(J)=C(J)*P
RETURN
END